//
//  MFAdxNative.h
//  IMMonetization
//
//  Created by pillow on 2025/8/11.
//  Copyright © 2025 MFAdxSDK. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class MFAdxTemplateView;

@protocol MFAdxNativeDelegate;

@interface MFAdxNative : NSObject

//初始化广告  adSize需要传递，请求广告时需要的参数
- (instancetype)initWithSlotID:(NSString *)slotID size:(CGSize)adSize;

//必选，接收回调的代理
@property (nonatomic, weak) id<MFAdxNativeDelegate> delegate;

//开始请求广告
- (void)loadAdData;

//广告的eCPM，单位：分 在mfadx_nativeAdDidLoad回调后可以调用
- (NSInteger)eCPM;

//竞价成功时上报接口
- (void)sendWinNotice;

//竞价失败时上报接口
//winPrice 胜出者价格 单位分
//winBidder 胜出者 （非必填）传递字符串为  @"chuanshanjia"、@"guangdiantong"、@"baidu"、@"other"
//info 其它信息 （非必填）比如 @{@"adTitle":@"广告标题",@"adShow":@"1",@"adClick":@"1"}
- (void)sendLossNoticeWithwinnerPirce:(NSInteger)winPrice winBidder:(NSString *)bidder otherInfo:(NSDictionary *)info;

//可以获取本次请求的requestID，通过requestID可获取该次广告的上报情况，仅用于测试阶段
-(NSString*)getRequestID;

@end

@protocol MFAdxNativeDelegate <NSObject>

@optional
//广告加载完成 adView为模版信息流MFAdxTemplateView，或者自渲染信息流MFAdxNativeView
- (void)mfadx_nativeAdDidLoad:(MFAdxNative *)nativeAd view:(UIView *)adView;

//广告加载失败
- (void)mfadx_nativeAd:(MFAdxNative *)nativeAd didFailWithError:(NSError *)error;

//广告曝光回调 adView 为MFAdxTemplateView或MFAdxNativeView
- (void)mfadx_nativeAdExposured:(UIView *)adView;

//广告被点击 adView 为MFAdxTemplateView或MFAdxNativeView
- (void)mfadx_nativeAdDidClick:(UIView *)adView;

//模版信息流渲染成功，执行MFAdxTemplateView的render方法后，有这个回调
- (void)mfadx_nativeRenderSuccess:(MFAdxTemplateView *)adView;

//模版信息流，用户点击了叉号，需要媒体移除该广告view
- (void)mfadx_nativeUserClickCloseButton:(MFAdxTemplateView *)adView;

@end

NS_ASSUME_NONNULL_END
